/**
 * 主路由文件
 *
 */
function router(app) {
  // 解决 ajax 跨域问题
  app.use('/forestage', (req, res, next) => {
    res.set({
      'Access-Control-Allow-Origin': 'http://127.0.0.1',
      'Access-Control-Allow-Credentials': 'true',
    });
	
	console.log("---主路由文件--forestage-");

    next();
  });
  
  // 解决 ajax 跨域问题
  app.use('/backStage', (req, res, next) => {
    res.set({
      'Access-Control-Allow-Origin': 'http://127.0.0.1',
      'Access-Control-Allow-Credentials': 'true',
    });
	
	console.log("---主路由文件--backStage-");

    next();
  });

  // 前台路由 
  //商品管理路由
  var Goods = require('./forestage/Goods');
  app.use('/forestage/Goods', Goods);

  //用户管理路由
  var user = require('./forestage/user');
  app.use('/forestage/user', user);

  //商品详情的评论信息
  var comment = require('./forestage/comment');
  app.use('/forestage/comment', comment);
	
  //股票信息查寻
  var GuPiao = require('./forestage/GuPiao');
  app.use('/forestage/GuPiao', GuPiao);

  //火车票信息查寻
  var Train = require('./forestage/Train');
  app.use('/forestage/Train', Train);



  // 后台路由
  var admin = require('./backStage/admin');
  app.use('/backStage/admin', admin);

  //阿里云上传文件
  var ali_oss = require('./backstage/ali_oss');
  app.use('/backstage/ali_oss', ali_oss);

  //后台商品管理
  var Admmin_Goods = require('./backstage/Admmin_Goods');
  app.use('/backstage/Admmin_Goods', Admmin_Goods);

 
  return app;
}

module.exports = router;
